<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>用户编辑</title>
    <%@ include file="top_new.jsp"%> 
</head>
<body>
<div style="padding-top: 20px;width: 98%">
    <form class="layui-form" action="<%=basePath%>tdic/tdicinfoSave" id="form">
    <input type="hidden" name="tdicinfo.fid" id="tdicinfo.fid" value="${tdicinfo.fid}">
    <input type="hidden" name="isLoad" id="isLoad" value="0">
        <div class="layui-form-item">
            <label class="layui-form-label">字典编码</label>
            <div class="layui-input-inline">
                <input type="text"  name="tdicinfo.fode" required  lay-verify="required" placeholder="请输入分类编码" autocomplete="off" class="layui-input" value="${tdicinfo.fode}">
            	<div class="layui-form-mid layui-word-aux">如30001，40001,wztype01(唯一不能重复)</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">字典名称</label>
            <div class="layui-input-inline">
                <input type="text" name="tdicinfo.fvalue" required  lay-verify="required" placeholder="请输入分类名称" autocomplete="off" class="layui-input" value="${tdicinfo.fvalue}">
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">字典分类</label>
            <div class="layui-input-block">
                <select name="tdicinfo.fsortcode" lay-verify="required">
                    <c:forEach items="${sorts}" var="s">
					<option value="${s.fsortcode}" >【${s.fsortcode}】${s.fname}</option>
				</c:forEach>
                </select>
            </div>
        </div>
 		<!--
        <div class="layui-form-item">
            <label class="layui-form-label">复选框</label>
            <div class="layui-input-block">
                <input type="checkbox" name="like[write]" title="写作">
                <input type="checkbox" name="like[read]" title="阅读" checked>
                <input type="checkbox" name="like[dai]" title="发呆">
            </div>
        </div>
         -->
        <div class="layui-form-item">
            <label class="layui-form-label">失效</label>
            <div class="layui-input-block">
                <input type="checkbox" name="fstats" lay-skin="switch" <c:if test="${tdicinfo.fstats == 1}">checked</c:if> <c:if test="${tdicinfo.fid == null}">disabled</c:if>>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">字典备注</label>
            <div class="layui-input-block">
                <textarea name="tdicinfo.fremark" placeholder="请输入内容" class="layui-textarea">${tdicinfo.fremark}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo"> 提 交 </button>
                <button type="reset" class="layui-btn layui-btn-primary"> 重 置 </button>
            </div>
        </div>
    </form>
</div>

<script>
    $(function(){
    	$("form").submit(function(){
    		var index = layer.load(2, {time: 10*1000}); //设定最长等待10秒 
    		var $form = $(this);
    		$.post($form.attr("action"), $form.serialize(), function(ret){
    			layer.close(index);
    			if (ret.isOk) {
    				$("#isLoad").val("1");
    				layer.msg("字典保存成功！", {shift: 1});
    				return false;
    			} else {
    				$("#image_code").click();
    				layer.msg(ret.msg, {shift: 6});
    				return false;
    			}
    		}, "json");
    		return false;
    	});
    });
</script>
</body>
</html>